﻿using System;

namespace WeChartWorkRobot.Service.Jobs
{
    public abstract class TriggerBase
    {
        internal protected virtual Quartz.ITrigger GetQuartzTrigger()
        {
            return null;
        }

        public virtual DateTimeOffset? GetNextRunTime()
        {
            return GetQuartzTrigger().GetNextFireTimeUtc()?.ToLocalTime();
        }

        public virtual DateTimeOffset? GetFirstRunTime()
        {
            return GetQuartzTrigger().GetFireTimeAfter(DateTimeOffset.Now)?.ToLocalTime();
        }
    }
}
